/**
 * 广寒宫
 * 网址:www.guanghangong.xyz
 */
package com.moon.admin.sys.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moon.admin.sys.entity.SysUserPostEntity;

/**
 * 员工岗位关系
 * @author ninglong
 */
@Mapper
public interface SysUserPostMapper extends BaseMapper<SysUserPostEntity>{

	/**
	 * 根据id获取用户的部门岗位信息
	 * @param userId
	 * @return
	 */
	@Select(value = "SELECT sup.id,sup.primaryed,sup.userId,sup.deptId,sup.postId,sd.deptName,sp.postName from sys_user_post sup LEFT JOIN sys_dept sd on(sup.deptId=sd.id) LEFT JOIN sys_post sp on(sup.postId=sp.id) where sup.deleted=0 and sd.deleted=0 and sp.deleted=0 and sup.userId=#{userId}")
	public List<SysUserPostEntity> getUserPostByUserId(Integer userId);
}
